package com.example.sjly;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import com.example.sjly.ui.home.HomeFragment;
import com.example.sjly.ui.mymaterial.MymaterialFragment;
import com.example.sjly.ui.order.OrderFragment;
import com.example.sjly.ui.scheduling.SchedulingFragment;

public class MyFragmentStateAdapter extends FragmentStateAdapter {
    public MyFragmentStateAdapter(FragmentActivity fragmentActivity) {
        super(fragmentActivity);
    }
    @Override
    public Fragment createFragment(int position)
    {
        switch (position){
            case 0:return new HomeFragment();
            case 1:return new SchedulingFragment();
            case 2:return new OrderFragment();
            case 3:return new MymaterialFragment();
        }
        return null;
    }
    @Override
    public int getItemCount()
    {
        return 4;
    }
}
